import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 轮播图信息 */
export interface CarouselImage {
          id: number; // 轮播图id
          carouselName?: string; // 轮播图名称
          sort?: number; // 显示顺序
          displayLocation?: number; // 展示位置（0首页顶部 1首页中部）
          status?: number; // 显示状态（0正常 1停用）
          jumpPath: string; // 跳转路径
          jumpId: number; // 跳转对象id
          imagePath?: string; // 图片地址
  }

// 轮播图 API
export const CarouselImageApi = {
  // 查询轮播图分页
  getCarouselImagePage: async (params: any) => {
    return await request.get({ url: `/biz/carousel-image/page`, params })
  },

  // 查询轮播图详情
  getCarouselImage: async (id: number) => {
    return await request.get({ url: `/biz/carousel-image/get?id=` + id })
  },

  // 新增轮播图
  createCarouselImage: async (data: CarouselImage) => {
    return await request.post({ url: `/biz/carousel-image/create`, data })
  },

  // 修改轮播图
  updateCarouselImage: async (data: CarouselImage) => {
    return await request.put({ url: `/biz/carousel-image/update`, data })
  },

  // 删除轮播图
  deleteCarouselImage: async (id: number) => {
    return await request.delete({ url: `/biz/carousel-image/delete?id=` + id })
  },

  /** 批量删除轮播图 */
  deleteCarouselImageList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/carousel-image/delete-list?ids=${ids.join(',')}` })
  },

  // 导出轮播图 Excel
  exportCarouselImage: async (params) => {
    return await request.download({ url: `/biz/carousel-image/export-excel`, params })
  },
}